package lab03.Test07;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;

/**
 * Created by Administrator on 2017/11/17.
 */
public class Test07 {
    public static void main(String[] args) {

        String path = "D:\\hello.zip";
        ZipInputStream zipInputStream = null;
        try {
            zipInputStream = new ZipInputStream(
                    new FileInputStream(path));
                ZipEntry entry;
                while ((entry = zipInputStream.getNextEntry())!=null){
                    System.out.println(entry.getName());//zip里面不能出现中文name;
                    System.out.println(entry.getMethod());//使用方法压缩
                }
        } catch (FileNotFoundException e) {


        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            try {
                zipInputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
